<template>
  <header class="app-header">
    <div class="header-content">
      <div class="header-main">
        <h1 class="site-title">
          <span class="title-icon">🪦</span>
          数字墓园
        </h1>
        <p class="site-subtitle">
          纪念那些曾经陪伴我们的数字产品
        </p>
      </div>
      
      <nav class="header-nav" v-if="showNav">
        <button 
          class="nav-button"
          :class="{ active: activeView === 'timeline' }"
          @click="$emit('view-change', 'timeline')"
        >
          时间线
        </button>
        <button 
          class="nav-button"
          :class="{ active: activeView === 'grid' }"
          @click="$emit('view-change', 'grid')"
        >
          网格视图
        </button>
        <button 
          class="nav-button"
          :class="{ active: activeView === 'stats' }"
          @click="$emit('view-change', 'stats')"
        >
          统计
        </button>
      </nav>
    </div>
    
    <!-- 装饰性元素 -->
    <div class="header-decoration">
      <div class="candle-light"></div>
      <div class="mist-effect"></div>
    </div>
  </header>
</template>

<script setup>
defineProps({
  activeView: {
    type: String,
    default: 'grid'
  },
  showNav: {
    type: Boolean,
    default: true
  }
})

defineEmits(['view-change'])
</script>

<style scoped>
.app-header {
  position: relative;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(139, 69, 19, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(75, 0, 130, 0.12) 0%, transparent 50%),
    linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(13, 13, 13, 0.98) 100%);
  border-bottom: 1px solid rgba(255, 140, 0, 0.3);
  padding: 2rem 0;
  overflow: hidden;
  backdrop-filter: blur(20px);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
}

.header-main {
  text-align: left;
}

.site-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(255, 140, 0, 0.3),
    0 0 40px rgba(255, 140, 0, 0.1);
  animation: titleGlow 4s ease-in-out infinite alternate;
}

.title-icon {
  font-size: 2rem;
  filter: 
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.4))
    drop-shadow(0 0 20px rgba(255, 140, 0, 0.3))
    drop-shadow(0 0 30px rgba(255, 140, 0, 0.2));
  animation: iconFlicker 3s ease-in-out infinite alternate;
}

.site-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0;
  opacity: 0.8;
}

.header-nav {
  display: flex;
  gap: 1rem;
}

.nav-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-button.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.3);
}

/* 装饰性效果 */
.header-decoration {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.candle-light {
  position: absolute;
  top: 15%;
  right: 8%;
  width: 150px;
  height: 150px;
  background: 
    radial-gradient(circle at 30% 30%, rgba(255, 140, 0, 0.4) 0%, rgba(255, 200, 100, 0.2) 40%, transparent 70%),
    radial-gradient(circle at 70% 70%, rgba(255, 160, 50, 0.3) 0%, transparent 60%);
  border-radius: 50%;
  filter: blur(15px);
  animation: candleFlicker 3s ease-in-out infinite alternate;
}

.candle-light::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(255, 220, 150, 0.6) 0%, transparent 50%);
  border-radius: 50%;
  filter: blur(8px);
  animation: innerFlame 2s ease-in-out infinite alternate;
}

.mist-effect {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: 
    linear-gradient(to top, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%),
    radial-gradient(ellipse at 30% 100%, rgba(255, 140, 0, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 100%, rgba(200, 200, 255, 0.03) 0%, transparent 60%);
  animation: mistFlow 12s ease-in-out infinite;
}

.mist-effect::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
  animation: mistFlow 15s ease-in-out infinite reverse;
}

@keyframes candleFlicker {
  0% { 
    opacity: 0.6; 
    transform: scale(1) rotate(0deg); 
  }
  25% { 
    opacity: 0.8; 
    transform: scale(1.05) rotate(1deg); 
  }
  50% { 
    opacity: 0.9; 
    transform: scale(1.1) rotate(-0.5deg); 
  }
  75% { 
    opacity: 0.7; 
    transform: scale(0.98) rotate(0.8deg); 
  }
  100% { 
    opacity: 0.75; 
    transform: scale(0.95) rotate(0deg); 
  }
}

@keyframes innerFlame {
  0% { 
    opacity: 0.8; 
    transform: scale(1) translateY(0); 
  }
  100% { 
    opacity: 1; 
    transform: scale(1.2) translateY(-5px); 
  }
}

@keyframes mistFlow {
  0%, 100% { 
    opacity: 0.4; 
    transform: translateX(0) translateY(0); 
  }
  25% { 
    opacity: 0.6; 
    transform: translateX(15px) translateY(-3px); 
  }
  50% { 
    opacity: 0.8; 
    transform: translateX(25px) translateY(-5px); 
  }
  75% { 
    opacity: 0.5; 
    transform: translateX(10px) translateY(-2px); 
  }
}

@keyframes titleGlow {
  0% {
    text-shadow: 
      0 2px 4px rgba(0, 0, 0, 0.5),
      0 0 20px rgba(255, 140, 0, 0.2),
      0 0 40px rgba(255, 140, 0, 0.1);
  }
  100% {
    text-shadow: 
      0 2px 4px rgba(0, 0, 0, 0.5),
      0 0 20px rgba(255, 140, 0, 0.4),
      0 0 40px rgba(255, 140, 0, 0.2),
      0 0 60px rgba(255, 140, 0, 0.1);
  }
}

@keyframes iconFlicker {
  0% {
    filter: 
      drop-shadow(0 0 10px rgba(255, 255, 255, 0.3))
      drop-shadow(0 0 20px rgba(255, 140, 0, 0.2))
      drop-shadow(0 0 30px rgba(255, 140, 0, 0.1));
  }
  100% {
    filter: 
      drop-shadow(0 0 10px rgba(255, 255, 255, 0.5))
      drop-shadow(0 0 20px rgba(255, 140, 0, 0.4))
      drop-shadow(0 0 30px rgba(255, 140, 0, 0.3))
      drop-shadow(0 0 40px rgba(255, 140, 0, 0.2));
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }
  
  .site-title {
    font-size: 2rem;
    justify-content: center;
  }
  
  .header-nav {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .nav-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 1.5rem 0;
  }
  
  .header-content {
    padding: 0 1rem;
  }
  
  .site-title {
    font-size: 1.8rem;
  }
  
  .site-subtitle {
    font-size: 1rem;
  }
}
</style>